﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/myFinance.Master" AutoEventWireup="true" CodeBehind="List.aspx.cs" Inherits="myFinance.Web.Views.Category.List" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
    $(document).ready(pageload);
    function pageload() {
        $("#adminmenu li a").removeClass("current");
        $("#category").addClass("current");
    }</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Category List</h2>
    <br />
    <a  id="edit" class="current" href='<%=Url.Action("Add") %>'>Add New Category</a>
    <br /><br />
    <table cellpadding="0" cellspacing="0" class="widefat">
        <thead>
            <tr class="head">
                <th>Category</th>
                <th>Description</th>
                <th>CategoryType</th>
                <th colspan="2" >Controls</th>
            </tr>
        </thead>
        <tbody>
            <%if (ViewData.Model.Count <= 0)
                {%>
                <tr class="last">
                    <td colspan="6" class="center">
                        <span class="sub">No Category are here!:)</span>
                    </td>
                </tr>
            <% }
      else
      {foreach (var category in ViewData.Model)
         {%>
            <tr id="category_<%=category.ID %>">
                <td class="main"><%=category.Name%></td>
                <td class="main"><%=category.Description%></td>
                 <td class="main"><%=category.CategoryType%></td>
                <td class="controls"><a href='/Category/Edit/<%=category.ID%>'><img src="../../Content/icons/edit.png" alt="edit" /> Edit</a></td>
				<td class="controls"><a href='/Category/Delete/<%=category.ID%>'><img src="../../Content/icons/delete.png" alt="delete" /> Delete</a></td>
				
            </tr>
         <%}
      }%>
        </tbody>
    </table>
    <div class="pager">
    <%
        if (ViewData.Model.HasPreviousPage)
        {%>
    <a href='<%=Url.Action("List", "Category",new {page = ViewData.Model.PageIndex - 1})%>'>
        Previous</a>
    <%
        }%>
    <%
        if (ViewData.Model.HasNextPage)
        {%>
    <a href='<%=Url.Action("List", "Category",new {page = ViewData.Model.PageIndex + 1})%>'>
        Next</a>
    <%
        }%>
</asp:Content>

